package com.xuecheng.media.task;

/**
 * @author yellow Doctor
 * @date 2025-11-20
 * @desc https://blog.csdn.net/hekai7217
 *   通过线程执行任务
 */
public class Demo01 {

    public static void main(String[] args) {

        //任务执行间隔时间
        final long timeInterval = 1000 * 10;
        Runnable runnable = new Runnable() {
            public void run() {
                while (true) {
                    //TODO：something
                    System.out.println(" 执行指定的任务.... " );
                    try {
                        Thread.sleep(timeInterval);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        Thread thread = new Thread(runnable);
        thread.start();

    }
}
